import { ProductCategory2Type, ProductCategory3Type } from '/@/util/product-type';

import { DataTimeSelectEnum, DataTimeListEnum } from '/@/enums/productEnum';

export const MergeList: ProductCategory2Type[] = [
  {
    category1: 'merge',
    category2: 'merge-dbnd',
    label: '地表浓度',
    title: '地表浓度',
    defaultItemKey: 'dbnd#PM25',
  },
  {
    category1: 'merge',
    category2: 'merge-dxxtscsb',
    label: '多星协同沙尘识别',
    title: '多星协同沙尘识别',
    defaultItemKey: 'dxsc',
  },
  {
    category1: 'merge',
    category2: 'merge-zhtq',
    label: '综合天气',
    title: '综合天气',
    defaultItemKey: 'zhtq#fog',
  },
  {
    category1: 'merge',
    category2: 'merge-scgcpz',
    label: '沙尘天气过程评估',
    title: '沙尘天气过程评估',
    defaultItemKey: 'scgcpz#fog',
  },
];

export const ProductList: ProductCategory3Type[] = [
  {
    category1: 'merge',
    category2: 'merge-dbnd',
    itemKey: 'dbnd#PM25',
    label: 'PM2.5',
    title: 'PM2.5',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
  {
    category1: 'merge',
    category2: 'merge-dbnd',
    itemKey: 'dbnd#PM10',
    label: 'PM10',
    title: 'PM10',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
  {
    category1: 'merge',
    category2: 'merge-dxxtscsb',
    itemKey: 'dxsc',
    label: '多源融合沙尘等级',
    title: '多源融合沙尘等级',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
  {
    category1: 'merge',
    category2: 'merge-zhtq',
    itemKey: 'zhtq#fog',
    label: '雾',
    title: '雾',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
  {
    category1: 'merge',
    category2: 'merge-zhtq',
    itemKey: 'zhtq#haze',
    label: '霾',
    title: '霾',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
  {
    category1: 'merge',
    category2: 'merge-zhtq',
    itemKey: 'zhtq#sand',
    label: '沙尘',
    title: '沙尘',
    dataTimeSelectType: DataTimeSelectEnum.NONE,
    dataTimeListType: DataTimeListEnum.DATA_TIME_LIST,
  },
];

export const getProductList12 = (category1: string, category2: string, size: number) => {
  const results: ProductCategory3Type[] = [];
  for (const item in ProductList) {
    if (size > 0 && results.length >= size) {
      return results;
    }
    if (ProductList[item].category1 == category1 && ProductList[item].category2 == category2) {
      results.push(ProductList[item]);
    }
  }
  return results;
};

export const getProductList1 = (category1: string, size: number) => {
  const results: ProductCategory3Type[] = [];
  for (const item in ProductList) {
    if (size > 0 && results.length >= size) {
      return results;
    }
    if (ProductList[item].category1 == category1) {
      results.push(ProductList[item]);
    }
  }
  return results;
};

export const getProductByItemKey = (itemKey: string) => {
  for (const i in ProductList) {
    if (ProductList[i].itemKey === itemKey) {
      return ProductList[i];
    }
  }
};
